#include <iostream>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <string>
#include <ctime>
using namespace std;
void test1()
{
    std::unordered_map<std::string, int> map;
    map.insert(std::make_pair("hello", 100));
    std::unordered_map<std::string, int>::iterator it = map.begin();
    for (; it != map.end(); ++it)
    {
        std::cout << it->first << " : " << it->second << std::endl;
    }
}

void test2()
{
    srand(time(0));
    vector<int> v;
    size_t N = 1000000; // 可以加到更大
    for (size_t i = 0; i < N; ++i)
    {
        // 这里采用大量随机值的测试样例！
        // v.push_back(rand());//少量随机值
        v.push_back(rand() + i); // 大量随机值
        // v.push_back(i);//有序值
    }
    set<int> st;
    unordered_set<int> uns;

    size_t begin1 = clock();
    for (const auto &e : v)
    {
        st.insert(e);
    }
    size_t end1 = clock();

    size_t begin2 = clock();
    for (const auto &e : v)
    {
        uns.insert(e);
    }
    size_t end2 = clock();

    cout << "set insert : " << end1 - begin1 << endl;
    cout << "unordered_set insert : " << end2 - begin2 << endl;

    size_t begin3 = clock();
    for (const auto &e : v)
    {
        st.find(e);
    }
    size_t end3 = clock();
    size_t begin4 = clock();
    for (const auto &e : v)
    {
        uns.insert(e);
    }
    size_t end4 = clock();
    cout << "set find : " << end3 - begin3 << endl;
    cout << "unordered_set find : " << end4 - begin4 << endl;


}

void test3()
{
    vector<int> v;
    v.push_back(1);
    v.push_back(1);
    v.push_back(1);
    v.push_back(1);
    v.push_back(1);

    v.resize(10,100);
    for(auto e : v)
    {
        cout<<e<<endl;
    }
    v.resize(5);
    for(auto e : v)
    {
        cout<<e<<endl;
    }
}
int main()
{
    // test1();
    // test2();
    test3();

    return 0;
}